<template>
  <div id="app">
    <div v-if="$route.path=='/'">
    <router-view/>
    </div>
    <div v-else class="navs">
      <div class="navBox">
        <div class="left">
          <router-link class="img" to="/healthy"  tag="div"><img :src="logo" alt=""></router-link>
          <router-link to="/healthy"  tag="div" :class="[$route.path.includes('/healthy')?'sel':null]">通行记录</router-link>
        </div>
        <div class="right">
          <el-button type="text" @click="logout"><i class="el-icon el-icon-position"></i>退出登陆</el-button>
        </div>
      </div>
      <router-view class="routerView"/>
    </div>
    <div>
    </div>
  </div>
</template>
<script>
export default {
  data(){
    return{
      logo:require("../src/assets/imgs/easylogo.jpg")
    }
  },
  methods:{
    logout(){
      this.$store.commit("removeToken")
      this.$router.push('/')
      this.$message.success("退出成功")
    }
  }
}
</script>

<style lang="scss" scoped>
.routerView{
  width: 100%;
  height: calc(100vh - 10vh);
  min-width: 950px;
  background:#EFF3F5;
  padding-top:calc(100vh *0.01);
}
.sel{

  color: #0d1b75;
  font-weight: 800;
}
#app{
  .navs{
    width: 100%;
    min-width: 950px;
    position: fixed;
    top: 0;
    .navBox{
      width: 85%;
      margin:0 auto;
      // background-color: #fff;
      display: flex;
      justify-content: space-between;
      position: sticky;
      height: 10vh;
      line-height: 10vh;
      top: 0;
      left: 0;
      .left{
          display: flex;
          user-select: none;
          .img{
            height: 100%;
            margin-right: 60px;
            display: flex;
            align-items: center;
            img{
              height: 5vh;
              // filter: invert(58%) sepia(57%) saturate(7498%) hue-rotate(209deg) brightness(104%) contrast(101%);
            }
          }
          div{
            padding: 0 10px;
            display: block;
            cursor: pointer;
          } 
          /* div.router-link-exact-active:not(.img){
            border-top:1px solid #397CFF;
            color: #397CFF;
          } */
      }
      .title{
        color: #397CFF;
        font-weight: 1000;
        margin-right:50px;
        font-size: 20px;
      }
      
    }
  }
}
</style>

